<%@ include file="/inc/taglibs.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>

<!-- start: Meta -->
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link id="bootstrap-style" href="<c:url value="/css/bootstrap.min.css"/>" rel="stylesheet">
<link href="<c:url value="/css/bootstrap-responsive.min.css"/>"
rel="stylesheet">
<link id="base-style" href="<c:url value="/css/style.css"/>"
	rel="stylesheet">
<link id="base-style-responsive"
	href="<c:url value="/css/style-responsive.css"/>" rel="stylesheet">
<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
<script src="<c:url value="/js/jquery-migrate-1.0.0.min.js"/>"></script>
<script src="<c:url value="/js/jquery-ui-1.10.0.custom.min.js"/>"></script>
<script src="<c:url value="/js/jquery.ui.touch-punch.js"/>"></script>
<script src="<c:url value="/js/modernizr.js"/>"></script>
<script src="<c:url value="/js/bootstrap.min.js"/>"></script>
<script src="<c:url value="/js/jquery.cookie.js"/>"></script>
<script src='<c:url value="/js/fullcalendar.min.js"/>'></script>
<script src='<c:url value="/js/jquery.dataTables.min.js"/>'></script>
<script src="<c:url value="/js/excanvas.js"/>"></script>
<script src="<c:url value="/js/jquery.flot.js"/>"></script>
<script src="<c:url value="/js/jquery.flot.pie.js"/>"></script>
<script src="<c:url value="/js/jquery.flot.stack.js"/>"></script>
<script src="<c:url value="/js/jquery.flot.resize.min.js"/>"></script>
<script src="<c:url value="/js/jquery.chosen.min.js"/>"></script>
<script src="<c:url value="/js/jquery.uniform.min.js"/>"></script>
<script src="<c:url value="/js/jquery.cleditor.min.js"/>"></script>
<script src="<c:url value="/js/jquery.noty.js"/>"></script>
<script src="<c:url value="/js/jquery.elfinder.min.js"/>"></script>
<script src="<c:url value="/js/jquery.raty.min.js"/>"></script>
<script src="<c:url value="/js/jquery.iphone.toggle.js"/>"></script>
<script src="<c:url value="/js/jquery.uploadify-3.1.min.js"/>"></script>
<script src="<c:url value="/js/jquery.gritter.min.js"/>"></script>
<script src="<c:url value="/js/jquery.imagesloaded.js"/>"></script>
<script src="<c:url value="/js/jquery.masonry.min.js"/>"></script>
<script src="<c:url value="/js/jquery.knob.modified.js"/>"></script>
<script src="<c:url value="/js/jquery.sparkline.min.js"/>"></script>
<script src="<c:url value="/js/counter.js"/>"></script>
<script src="<c:url value="/js/retina.js"/>"></script>
<script src="<c:url value="/js/custom.js"/>"></script>
<script src="<c:url value="/js/laydate/laydate.js"/>"></script>

<script type="text/javascript">
	//下载
	function downloadExcel() {
		location.href = '<c:url value="/img/common/performance.xls"/>';
	}
	//导入
	function importExcel() {
		//检验导入的文件是否为Excel文件
		var uploadFile = document.getElementById("uploadFile").value;
		if (uploadFile == null || uploadFile == '') {
			alert("请选择要上传的Excel文件");
			return;
		} else {
			var fileExtend = uploadFile.substring(uploadFile.lastIndexOf('.')).toLowerCase();
			if (fileExtend == '.xls') {
			} else {
				alert("文件格式需为'.xls'格式");
				return;
			}
		}
		var load = new Loading();
		load.init();
		load.start();
		$("#importExcel").submit();
	}
	
	 function closebutton() {
		 var index = parent.layer.getFrameIndex(window.name);  
	 	parent.layer.close(index);  
	 }
	
	 $(function(){ 
		 var msg="${msg}";
		 if(msg!=null&&msg!=""){
			 window.parent.location.reload(); //刷新父页面
			 var index = parent.layer.getFrameIndex(window.name);  
			 parent.layer.close(index);  
			 alert(msg);
		 }
	 }); 
</script>
</head>
<body>
	<div id="layer">
		<form id="importExcel" enctype="multipart/form-data" action="<%=basePath%>salaryc/improtExcel" method="post">
				<table class="table table-striped table-bordered bootstrap-datatable">
					<tbody>
						<tr>
							<td>
								<span class="default">请严格按照模板导入数据，不得随意修改</span><br> 
								<span class="default">为了快速导入，每次导入的数据尽量少于1000条</span><br> 
								<span class="default">表格为xls格式，数据为文本格式</span><br>
							</td>
						</tr>
						<tr>
							<td>
								<button class="default" onclick="downloadExcel();return false;" style="margin: 20px 0px 0px 0px">
									下载模板
								</button>
							</td>
						</tr>
						<tr>
							<td>
								<div class="title">
									<span>上传表格文件：</span>
								</div>
							</td>
						</tr>
						<tr>
							<td><input type="file" id="uploadFile" name="uploadFile" />
								<button class="default" onclick="importExcel();return false;">
									上传文件
								</button></td>
						</tr>
						
						<tr>
						<td style="text-align: center;">
							<div>
								<button style="width: 15%" type="button" onclick="closebutton();" id="output1">关闭</button>
							</div>
						</td>
					</tr>
						</tbody>
				</table>
		</form>
	</div>
</body>
</html>
